cc.Class({
    extends: cc.Component,

    properties: {
        icon: cc.Sprite,
        priceIcon: cc.Label,
        priceBuy: cc.Label,
        title: cc.Label,
        desc: cc.RichText,
    },

    init(data) {
        this.title.string = data.title;
        this.icon.loadImage(data.icon, () => {
            this.icon.node.width = this.icon.node.height = 124;
        });
        this.desc.string = data.desc;
        if(data.priceIcon) {
            this.priceIcon.string = data.priceIcon;
        } else {
            this.priceIcon.node.parent = null;
        }
        this.priceBuy.string = data.priceBuy;
        this.priceBuy.node.parent.on('click', () => {
            cc.Proxy.gameCharge(data);
            this.node.emit('close');
        });
    },

});
